package com.hc.music.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class FileConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //http://localhost:8088/img/singePic/user.jpg
        registry.addResourceHandler("/img/singerPic/**")
                .addResourceLocations("file:"+System.getProperty("user.dir")+"/img/singerPic/");
        registry.addResourceHandler("/img/songPic/**")
                .addResourceLocations("file:"+System.getProperty("user.dir")+"/img/songPic/");
        registry.addResourceHandler("/img/songListPic/**")
                .addResourceLocations("file:"+System.getProperty("user.dir")+"/img/songListPic/");
        registry.addResourceHandler("/song/**")
                .addResourceLocations("file:"+System.getProperty("user.dir")+"/song/");
        registry.addResourceHandler("/lrc/**")
                .addResourceLocations("file:"+System.getProperty("user.dir")+"/lrc/");
        registry.addResourceHandler("/img/userPic/**")
                .addResourceLocations("file:"+System.getProperty("user.dir")+"/img/userPic/");
        registry.addResourceHandler("/img/bannerPic/**")
                .addResourceLocations("file:"+System.getProperty("user.dir")+"/img/bannerPic/");
    }
}
